Skip to content

BE-512: HashQL: Allow cross-backend transitions for SwitchInt terminators#8696

Open
indietyp wants to merge 1 commit into
bm/be-524-hashql-remove-island-dagfrom
bm/be-512-hashql-switchint-allow-cross-backend-transitions
Open

BE-512: HashQL: Allow cross-backend transitions for SwitchInt terminators#8696
indietyp wants to merge 1 commit into
bm/be-524-hashql-remove-island-dagfrom
bm/be-512-hashql-switchint-allow-cross-backend-transitions

Conversation

@indietyp
Copy link
Copy Markdown
Member

@indietyp indietyp commented May 4, 2026

🌟 What is the purpose of this PR?

SwitchInt terminators were previously blocked from generating cross-backend transitions during terminator placement, based on an assumption that coordinating branches across backends would be too complex. This restriction has been lifted, allowing SwitchInt to behave the same as Goto and permit cross-backend transitions. This enables more flexible execution placement for conditional branching logic.

🔍 What does this change?

  • SwitchInt now calls add_goto_transitions instead of being a no-op, enabling cross-backend edge costs to be populated for blocks ending with a SwitchInt terminator.
  • The test switchint_blocks_cross_backend has been renamed to switchint_allows_cross_backend and updated to assert that the Interpreter -> Embedding transition is now reachable with the expected cost.
  • The switchint_edge_targets_are_branch_specific test has been updated to assert that cross-backend transitions are present rather than absent.
  • The terminator placement snapshot has been updated to reflect the newly populated I->E and P->E transitions on edge[1].

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

🛡 What tests cover this?

  • Updated unit tests in terminator_placement/tests.rs covering SwitchInt cross-backend transition behaviour.
  • Updated snapshot test reflecting the new edge cost matrix output.

❓ How to test this?

  1. Run cargo test in libs/@local/hashql/mir.
  2. Confirm all terminator placement tests pass, including the renamed switchint_allows_cross_backend test.

@vercel
Copy link
Copy Markdown

vercel Bot commented May 4, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hash Ready Ready Preview, Comment May 28, 2026 1:35pm
petrinaut Ready Ready Preview May 28, 2026 1:35pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
hashdotdesign-tokens Ignored Ignored Preview May 28, 2026 1:35pm

@vercel vercel Bot temporarily deployed to Preview – petrinaut May 4, 2026 12:52 Inactive
@cursor
Copy link
Copy Markdown

cursor Bot commented May 4, 2026

PR Summary

Medium Risk
Changes execution-planning cost matrices for conditional branches, which can shift backend placement decisions though Postgres/loop/GraphRead rules are unchanged.

Overview
Terminator placement now treats SwitchInt edges like Goto: add_terminator_specific_transitions routes both through add_goto_transitions, so cross-backend transitions (e.g. Interpreter ↔ Embedding) get transfer plus switch costs instead of being omitted.

Tests and the terminator placement snapshot were updated to expect those edges on SwitchInt branches (including per-branch successor targets).

Reviewed by Cursor Bugbot for commit 7323f1e. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > backend Owned by the @backend team area/tests New or updated tests labels May 4, 2026
This was referenced May 4, 2026
Copy link
Copy Markdown
Member Author

indietyp commented May 4, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@augmentcode
Copy link
Copy Markdown

augmentcode Bot commented May 4, 2026

🤖 Augment PR Summary

Summary: Enables cross-backend transitions for blocks ending in SwitchInt terminators, aligning their behavior with Goto during terminator placement.
Changes: Updates the edge-cost matrix population logic and adjusts unit/snapshot tests to assert newly reachable cross-backend paths with expected costs.

🤖 Was this summary useful? React with 👍 or 👎

Copy link
Copy Markdown

@augmentcode augmentcode Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review completed. No suggestions at this time.

Comment augment review to trigger a new review at any time.

@codecov
Copy link
Copy Markdown

codecov Bot commented May 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.10%. Comparing base (3dfb99e) to head (7323f1e).

Additional details and impacted files
@@                          Coverage Diff                           @@
##           bm/be-524-hashql-remove-island-dag    #8696      +/-   ##
======================================================================
- Coverage                               59.11%   59.10%   -0.01%     
======================================================================
  Files                                    1341     1341              
  Lines                                  129570   129566       -4     
  Branches                                 5849     5849              
======================================================================
- Hits                                    76589    76585       -4     
  Misses                                  52078    52078              
  Partials                                  903      903              
Flag Coverage Δ
apps.hash-ai-worker-ts 1.41% <ø> (ø)
apps.hash-api 0.00% <ø> (ø)
local.hash-backend-utils 2.81% <ø> (ø)
local.hash-graph-sdk 9.63% <ø> (ø)
local.hash-isomorphic-utils 0.00% <ø> (ø)
rust.hash-graph-api 2.52% <ø> (ø)
rust.hashql-compiletest 28.26% <ø> (ø)
rust.hashql-eval 75.69% <ø> (ø)
rust.hashql-mir 86.94% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 11715f8 to bb97a73 Compare May 20, 2026 14:46
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 5203abe to 026ce7b Compare May 20, 2026 14:46
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from bb97a73 to 7c2c99f Compare May 22, 2026 11:21
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 026ce7b to b7cf577 Compare May 22, 2026 11:21
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 7c2c99f to fed3275 Compare May 25, 2026 13:27
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from b7cf577 to db1e44d Compare May 25, 2026 13:27
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from fed3275 to 2ffc3ed Compare May 25, 2026 13:58
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from db1e44d to 0a4f75a Compare May 25, 2026 13:58
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 2ffc3ed to 5aa1fb4 Compare May 25, 2026 14:01
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 0a4f75a to 40c3c68 Compare May 25, 2026 14:01
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from 40c3c68 to f9a8499 Compare May 26, 2026 07:25
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from f9a8499 to c883c9e Compare May 27, 2026 07:11
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from 2fc2314 to c62ac8e Compare May 27, 2026 07:11
@indietyp indietyp force-pushed the bm/be-512-hashql-switchint-allow-cross-backend-transitions branch from c883c9e to 7323f1e Compare May 28, 2026 13:27
@indietyp indietyp force-pushed the bm/be-524-hashql-remove-island-dag branch from c62ac8e to 3dfb99e Compare May 28, 2026 13:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/libs Relates to first-party libraries/crates/packages (area) area/tests New or updated tests type/eng > backend Owned by the @backend team

Development

Successfully merging this pull request may close these issues.

1 participant